package com.longxi.tianjintianbao.ui.activity.quality;

import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.quality.QualityScoreAtPresenter;
import com.longxi.tianjintianbao.ui.view.quality.IQualityScoreContentAtView;

import butterknife.BindView;

public class QualityScoreActivity extends BaseActivity<IQualityScoreContentAtView, QualityScoreAtPresenter> implements IQualityScoreContentAtView {
    @BindView(R.id.tvItemName)
    TextView mTvItemName;
    @BindView(R.id.etScore)
    EditText mEtScore;
    @BindView(R.id.etReason)
    EditText mEtReason;
    @BindView(R.id.radioRectification)
    RadioGroup mRadioRectification;
    @BindView(R.id.btnLogin)
    Button mBtnLogin;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_quality_score;
    }

    @Override
    public void initData() {
        super.initData();
        mPresenter.setBar();
    }

    @Override
    public void initListener() {
        super.initListener();
        mBtnLogin.setOnClickListener(v -> mPresenter.saveQualityScore());
        mRadioRectification.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if(checkedId == R.id.rBtnYes){
                    mPresenter.rectification = "是";
                }else{
                    mPresenter.rectification = "否";
                }
            }
        });
    }

    @Override
    protected QualityScoreAtPresenter createPresenter() {
        return new QualityScoreAtPresenter(this);
    }

    @Override
    public TextView getTvItemName() {
        return mTvItemName;
    }

    @Override
    public EditText getEtScore() {
        return mEtScore;
    }

    @Override
    public EditText getEtReason() {
        return mEtReason;
    }

    @Override
    public RadioGroup getRadioRectification() {
        return mRadioRectification;
    }

    @Override
    public Button getBtnLogin() {
        return mBtnLogin;
    }


}


